package org.robert.export_client.demo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.*;
import org.apache.commons.lang3.StringUtils;
import org.robert.export_client.aop.*;
import org.robert.export_client.excel.metadata.ComparisonEnum;

import java.io.Serializable;
import java.util.Date;

/**
 * @Description
 * @Author robert
 * @Date 2024/1/13 15:49
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ExcelTempDemo implements Serializable {

    private static final long serialVersionUID = -8452582000542971719L;

    @ExcelIgnore
    private Integer id;

    @ExcelProperty(value = "名称", index = 1)
    @com.alibaba.excel.annotation.ExcelProperty(value = "名称")
    @ColumnWidth(20)
    private String name;
    @ExcelProperty(value = "账号")
    @com.alibaba.excel.annotation.ExcelProperty(value = "账号")
    @ColumnWidth(20)
    private String number;

    @ExcelProperty(value = "描述", index = 7)
    @com.alibaba.excel.annotation.ExcelProperty(value = "描述")
    @ColumnWidth(20)
    @ExcelDepend(value = "1", name = "state", type = ComparisonEnum.EQUAL, valueType = String.class)
    private String description;

    @ExcelJson(parserFor = JSONTest.class)
    private String ext;

    @ExcelProperty(value = "状态", index = 3)
    @com.alibaba.excel.annotation.ExcelProperty(value = "状态")
    @ColumnWidth(20)
    @ExportDict(value = "STATE")
    public String state;

    @ExcelProperty(value = "创建时间")
    @com.alibaba.excel.annotation.ExcelProperty(value = "创建时间")
    @ColumnWidth(30)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelDepend(type = ComparisonEnum.FIXED_VALUE_NOBLANK, valueType = Date.class)
    private Date createDate;

    @ExcelProperty(value = "处理日志")
    @ExcelFieldMerge(value = "connect", total = 3)
    private String connect;
    @ExcelFieldMerge(value = "connect", index = 2)
    private String connect1;
    @ExcelFieldMerge(value = "connect", index = 1)
    private String connect2;

    @ExcelProperty(value = "手机号", index = 10)
    @ColumnWidth(20)
    @ExcelDepend(value = StringUtils.EMPTY, fixedValue = "数据加密", type = ComparisonEnum.FIXED_VALUE_NOBLANK, isFixed = true)
    private String phone;

    @ExcelProperty(value = "部门", index = 11)
    @ExcelFieldMerge(value = "deptPName", total = 2, connect= "/")
    private String deptPName;
    @ExcelFieldMerge(value = "deptPName", index = 1)
    private String deptName;


}
